package branch.action;

import branch.Branch;
import branch.BranchConnectionThread;
import branch.snapshot.Marker;

/**
 * Action that starts a global snapshot of the distributed system
 * @author AJ
 *
 */
public class TakeSnapShotAction implements IBranchAction {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -3223636815208691306L;
	
	private Marker marker;

	public TakeSnapShotAction(Marker marker) {
		this.marker = marker;
	}

	@Override
	public void execute(BranchConnectionThread branchConnectionThread) {
		// TODO Auto-generated method stub
		System.out.println("Snapshot");
		
		Branch branch = branchConnectionThread.getBranch();
		branch.receiveMarker(marker, branchConnectionThread);
    }
	
	public Marker getMarker(){
		return marker;
	}
}
